import 'package:flutter/material.dart';
import 'package:login/dao/login_dao.dart';
import 'package:login/util/navigator_util.dart';

class HomePage extends StatefulWidget {
  const HomePage({super.key});

  @override
  State<HomePage> createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  @override
  Widget build(BuildContext context) {
    NavigatorUtil.updateContext(context);
    return Scaffold(
      appBar: AppBar(title: const Text('ChatGPT')),
      body: _listView(),
    );
  }

  _listView() {
    return ListView(
      children: [
        _logoutBtn(),
        const Text('首页'),
      ],
    );
  }

  _logoutBtn() {
    return ElevatedButton(onPressed: () => {LoginDao.logout()}, child: const Text('登出'));
  }
}
